#include <QCoreApplication>
#include <QTextStream>
#include <QDebug>

#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonValue>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    
    QVariantMap object;
    object.insert("label", "fuck");
    object.insert("detail", "hello");

    auto types = QStringList() << "linux" << "windows" << "mac";
    object.insert("type", types.join("|"));

    auto temporary_shell_commands = QStringList() << "xdg-open http://bing.com";

    QVariantMap temporary_shell;
    temporary_shell.insert("delay", 0);
    temporary_shell.insert("commands", temporary_shell_commands);

    auto temporary_commands = QStringList() << "workbench.files.action.refreshFilesExplorer";

    QVariantMap temporary;
    temporary.insert("message", "");
    temporary.insert("action", "shell");
    temporary.insert("shell", temporary_shell);
    temporary.insert("commands", temporary_commands);

    object.insert("template", temporary);

    QTextStream(stdout) 
        << QJsonDocument::fromVariant(object).toJson() << "\n";

    return 0;
    // return a.exec();
}

// Output:

// {
//     "detail": "hello",
//     "label": "fuck",
//     "template": {
//         "action": "shell",
//         "commands": [
//             "workbench.files.action.refreshFilesExplorer"
//         ],
//         "message": "",
//         "shell": {
//             "commands": [
//                 "xdg-open http://bing.com"
//             ],
//             "delay": 0
//         }
//     },
//     "type": "linux|windows|mac"
// }